<?php

namespace App\Services\User;


use App\Services\ProjectValidate;

class ValidateRole extends ProjectValidate
{
//
//
//    protected $scene = [
//        'add' => ['name', 'weight'],
//        'stop' => ['id', 'name'],
//        'start' => ['id', 'name'],
//        'list' => ['page', 'list_rows'],
//        'edit' => ['id', 'name', 'name_cn', 'weight', 'menu'],
//        'getIdsByRoles' => ['roles'],
//        'apply' => ['app_id','user_id', 'role_id', 'apply_info'],
//        'allowApply' => ['app_id', 'user_id'],
//        'giveRoles' => ['id', 'name', 'phone', 'role_id'],
//        'allRolesByApp' => ['id', 'name', 'app_key'],
//        'removeUserRole' => ['id', 'name', 'phone', 'role_id'],
//    ];
    /**
     * 自定义子类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
        // TODO: Implement initValidate() method.
    }


    /**
     * @var array 验证规则集合
     */
    public $rules = [
        'id'            => 'integer|min:0',
        'name'          => 'alpha_num|between:2,20',
        'name_cn'       => 'between:2,20',
        'weight'        => 'integer|between:0,100',
        'menu'          => 'min:2',
        'roles'         => 'min:2',
        'app_id'        => 'integer|min:0',
        'user_id'       => 'integer|min:0',
        'role_id'       => 'integer|min:0',
        'apply_info'    => 'regex:/^{.*}$',
    ];

    /**
     * @var array 当前验证错误信息
     */
    public $messages = [
    ];

    /**
     * @var array 上面规则中定义的 key 的名字
     */
    public $attributes = [
    ];
}
